const ADD = 'add'
const CUT = 'cut'

// reduce
export function counter(state = 10, action) {
  switch (action.type) {
    case ADD:
      return state + 1
    case CUT:
      return state - 1
    default:
      return state
  }
}

export function addAction() {
  return {type: ADD}
}
export function cutAction() {
  return {type: CUT}
}

export function addActionAsync() {
  return dispatch => {
    setTimeout(() => {
      dispatch(addAction())
    },3000)
  }
}